package cn.online.taxi.common.test;

import java.util.LinkedHashSet;
import java.util.Scanner;

public class Hill {
    public static void sort(int []arr) {
        for(int gap = arr.length / 2; gap > 0; gap /= 2) {
            for(int i = gap; i < arr.length; i++) {
                int j = i;
                while(j - gap >= 0 && arr[j] < arr[j - gap]) {
                    swap(arr, j, j - gap);
                    j -= gap;
                }
            }
        }
    }

    public static void swap(int []arr, int a, int b) {
        arr[a] = arr[a] + arr[b];
        arr[b] = arr[a] - arr[b];
        arr[a] = arr[a] - arr[b];
    }

    public static Object[] toClear(int [] arr) {
        LinkedHashSet<Object> linkedHashSet = new LinkedHashSet<Object>();
        for(int i = 0; i < arr.length; i++) {
            linkedHashSet.add(arr[i]);
        }
        return linkedHashSet.toArray();
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int []arr = new int[n];
        for(int i = 0; i < arr.length; i++) {
            arr[i] = sc.nextInt();
        }
        sort(arr);
        Object[] newArr = toClear(arr);
        System.out.println(newArr.length);
        for(Object item:newArr) {
            System.out.print(item + " ");
        }
    }
}
